﻿using LDM.Framework.WebApiClientCore;
using LDM.Sys.ServiceAPI.Model.DBModel;
using LDM.Sys.ServiceAPI.Model.ViewModel.Request;
using LDM.Sys.ServiceAPI.Model.ViewModel.Response.Login;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebApiClientCore;
using WebApiClientCore.Attributes;
using HttpPostAttribute = WebApiClientCore.Attributes.HttpPostAttribute;

namespace LDM.Sys.ServiceAPI.Svc
{
    /// <summary>
    /// 订单服务
    /// </summary>
    [HttpApiOptions("LDM.Sys.API")]
    [LoggingFilter]
    [Timeout(10 * 1000)] // 10s超时
    public interface ILoginService : IHttpApi, IScoped
    {
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="loginReq"></param>
        /// <returns></returns>
        [HttpPost("Login/UserLogin")]
        public Task<LoginRes> Login([JsonContent] WxLoginReq loginReq);

        /// <summary>
        /// 微信用户登录
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("WxLogin/GetWxLogin")]
        public Task<UserLoginRes> GetWxLogin([JsonContent] GetWxLoginRequest request);


        /// <summary>
        /// 同步微信用户数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("WxLogin/SyncWxUserInfo")]
        public Task<bool> SyncWxUserInfo([JsonContent] SyncWxUserInfoRequest request);

        /// <summary>
        /// 异常测试
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        [HttpPost("Demo/GetAbnormal")]
        public Task<UserLoginRes> GetAbnormal(int num = 0);

        /// <summary>
        /// 获取用户id
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        [HttpPost("Demo/GetUserId")]
        public Task<string> GetUserId();

        /// <summary>
        /// 获取微信用户信息
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        [HttpPost("WxLogin/GetUserInfo")]
        public Task<WxAccount> GetUserInfo(string token);
    }
}
